//
//  XiaoKaiAttackTableViewCell.m
//  Project_A
//
//  Created by 凯 on 15/7/14.
//  Copyright (c) 2015年 zhoukaidong. All rights reserved.
//

#import "TypeTableViewCell.h"
#import "BaseHeader.h"

@implementation TypeTableViewCell

-(void)dealloc
{
    [super dealloc];
    [[NSNotificationCenter defaultCenter]removeObserver:self name:@"creloda" object:nil];
    
}
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    
    [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(collectionReload:) name:@"creloda" object:nil];
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        UICollectionViewFlowLayout *layout = [[[UICollectionViewFlowLayout alloc]init]autorelease];
        layout.itemSize = CGSizeMake(SCREEN_WIDTH / 5 , SCREEN_WIDTH / 5);
        layout.scrollDirection = UICollectionViewScrollDirectionVertical;
        layout.minimumInteritemSpacing = 5;
        layout.minimumLineSpacing = SCREEN_HEIGHT / 20 ;
        layout.sectionInset = UIEdgeInsetsMake(10, 20, 0, 20);
        self.collectionView = [[UICollectionView alloc]initWithFrame:CGRectMake(0,0  , SCREEN_WIDTH, 1000) collectionViewLayout:layout];
//        self.collectionView.backgroundColor = [UIColor orangeColor];
        
        _collectionView.backgroundColor = [UIColor whiteColor];
        _collectionView.showsVerticalScrollIndicator = NO;
        [_collectionView registerClass:[TypeCollectionViewCell class] forCellWithReuseIdentifier:@"cell"];
        [_collectionView registerClass:[TypeCollectionViewCell class] forCellWithReuseIdentifier:@"cell1"];
        [_collectionView registerClass:[TypeCollectionViewCell class] forCellWithReuseIdentifier:@"cell2"];
        [_collectionView registerClass:[TypeCollectionViewCell class] forCellWithReuseIdentifier:@"cell3"];
        [self.contentView addSubview:_collectionView];
    }
    return self;
}
- (void)drawWithSecation:(NSInteger)section index:(NSInteger)index
{
    
    
    
}
- (void)collectionReload:(NSNotification *)result
{
    [self.collectionView reloadData];
}
- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
